using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerJumpState : State
{
    public PlayerJumpState(Player _player, string _Animname, StateMachine _stateMachine) : base(_player, _Animname, _stateMachine)
    {
    }

    public override void Enter()
    {
        base.Enter();

        Player.SetVelocity(rb.velocity.x, Player.JumpForce);
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        xInput = Settings.inputActions.PlayerInputAction.MoveBinding.ReadValue<Vector2>().x;
        Player.SetVelocity(xInput, rb.velocity.y);

        if(rb.velocity.y < 0)
        {
            StateMachine.ChangeState(Player.AirState);
        }
    }
}
